//
//  PopCollectionViewCell.m
//  SugarPile
//
//  Created by Charlie. on 16/1/25.
//  Copyright © 2016年 www.lanou39.蓝鸥科技. All rights reserved.
//

#import "PopCollectionViewCell.h"

@implementation PopCollectionViewCell
-(void)dealloc
{
    [_iconImage release];
    [_nameLabel release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.iconImage = [[UIImageView alloc] init];
//        _iconImage.backgroundColor = [UIColor goldColor];
        [self.contentView addSubview:_iconImage];
        [_iconImage release];
        
        self.nameLabel = [[UILabel alloc] init];
//        _nameLabel.backgroundColor = [UIColor royalBlue];
        [self.contentView addSubview:_nameLabel];
        [_nameLabel release];
    }
    return self;
}
// 布局
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    _iconImage.frame = CGRectMake(0, 0, layoutAttributes.bounds.size.width, layoutAttributes.bounds.size.height - 20);
    // 文本居中
    _nameLabel.frame = CGRectMake(0, layoutAttributes.bounds.size.height - 20, layoutAttributes.bounds.size.width, 20);
    // 居中
    _nameLabel.textAlignment = NSTextAlignmentCenter;
    // 字大小
    _nameLabel.font = [UIFont systemFontOfSize:11];
}
@end
